#!/bin/bash
#IModule

#########################
#   名称: Locale
#   用途: 提供本地化
#########################

#shellcheck disable=SC2059
if [ -z "$_Locale_Loaded" ];then
    function _framework_resolve_dependencies()
    {
        true;
    }

    export TEXTDOMAIN="SimpleLocale";
    #shellcheck disable=SC2154
    export TEXTDOMAINDIR="${_framework_ROOT}/locales";

    function _Locale_get()
    {
        local msgid="${1:-"_Generic_NoMsg"}";
        shift;
        local msg;
        msg="$(gettext -s "$msgid")";
        if [ "$msg" == "$msgid" ];then
            _Logger_Log Error "[Locale] 未能找到任何与 $msgid 对应的文本";
        fi;
        printf "$msg" "$@";
    }

    readonly _Locale_Loaded=true;
fi;
